//
//  MyActionSheet.h
//  yuikemall
//
//  Created by yuike5 yuike5 on 12-6-2.
//  Copyright (c) 2012年 yuike. All rights reserved.
//
#import <UIKit/UIKit.h>
//#import "MyBackground9.h"


@class MyActionSheet;


@protocol MyActionSheetDelegate <NSObject>
@optional

// Called when a button is clicked. The view will be automatically dismissed after this call returns
- (void)myActionSheet:(MyActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex title:(NSString*)title;

// Called when we cancel a view (eg. the user clicks the Home button). This is not called when the user clicks the cancel button.
// If not defined in the delegate, we simulate a click in the cancel button
- (void)myActionSheetCancel:(MyActionSheet *)actionSheet;
@end




@interface MyActionSheet : UIView<UIGestureRecognizerDelegate>
{
    NSMutableArray* buttonTitles;
    UIImageView* background;
    
    CGRect rect;
    UIView* parent;       
    id<MyActionSheetDelegate> delegate;
    
    UIInterfaceOrientation orientation;
}

- (id)initWithDelegate:(id<MyActionSheetDelegate>)delegate buttonTitles:(NSString *)buttonTitles, ... NS_REQUIRES_NIL_TERMINATION;

- (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated;

- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;
- (NSInteger)addButtonWithTitle:(NSString *)title;    // returns index of button. 0 based.

@property(nonatomic,readonly) NSInteger numberOfButtons;
@end
